<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>黑名单管理系统</title>
    <script>
        // 页面加载时设置默认用户信息
        (function() {
            // 设置默认的黑名单管理用户信息
            if (!localStorage.getItem('blacklistCurrentUser')) {
                localStorage.setItem('blacklistCurrentUser', JSON.stringify({
                    name: '黑名单管理员',
                    role: '黑名单管理员'
                }));
                localStorage.setItem('blacklistIsLoggedIn', 'true');
            }
        })();
    </script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: #333;
            min-height: 100vh;
        }

        .container {
            display: flex;
            min-height: 100vh;
        }

        /* 左侧侧边栏 */
        .sidebar {
            width: 280px;
            background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 50%, #3b82f6 100%);
            color: white;
            padding: 0;
            box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
            position: fixed;
            height: 100vh;
            overflow-y: auto;
        }

        .sidebar-header {
            padding: 30px 20px;
            background: rgba(255, 255, 255, 0.1);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            margin-bottom: 20px;
            text-align: center;
        }

        .sidebar-title {
            font-size: 22px;
            font-weight: bold;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .nav-menu {
            list-style: none;
            padding: 0 15px;
        }

        .nav-item {
            margin-bottom: 8px;
        }

        .nav-link {
            display: flex;
            align-items: center;
            padding: 15px 20px;
            color: white;
            text-decoration: none;
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: 12px;
            border-left: 4px solid transparent;
        }

        .nav-link:hover, .nav-link.active {
            background: rgba(255, 255, 255, 0.1);
            border-left-color: #60a5fa;
            transform: translateX(5px);
        }

        .nav-icon {
            margin-right: 15px;
            font-size: 18px;
        }

        /* 右侧主内容区域 */
        .main-content {
            flex: 1;
            margin-left: 280px;
            padding: 30px;
            background: rgba(255, 255, 255, 0.95);
        }

        .content-header {
            background: white;
            padding: 25px 30px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        .header-left h1 {
            font-size: 28px;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .breadcrumb {
            color: #6b7280;
            font-size: 14px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        .user-avatar {
            width: 50px;
            height: 50px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            color: white;
        }

        .user-details {
            text-align: right;
        }

        .user-name {
            font-weight: bold;
            color: #1e3a8a;
            margin-bottom: 4px;
        }

        .user-role {
            color: #6b7280;
            font-size: 14px;
        }

        .btn-logout {
            background: #ef4444;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .btn-logout:hover {
            background: #dc2626;
        }

        /* 功能模块样式 */
        .function-module {
            background: white;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
            overflow: hidden;
        }

        .module-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            font-size: 18px;
            font-weight: bold;
        }

        .module-content {
            padding: 30px;
        }

        /* 数据表格样式 */
        .data-table {
            width: 100%;
            border-collapse: collapse;
            background: white;
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .data-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }

        .data-table td {
            padding: 15px;
            border-bottom: 1px solid #e5e7eb;
        }

        .data-table tr:hover {
            background: #f8fafc;
        }

        .status-badge {
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-blacklisted {
            background: #fef2f2;
            color: #dc2626;
        }

        .status-active {
            background: #dcfce7;
            color: #166534;
        }

        .action-buttons {
            display: flex;
            gap: 8px;
        }

        .btn-action {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            transition: all 0.3s ease;
        }

        .btn-action-blacklist {
            background: #dc2626;
            color: white;
        }

        .btn-action-blacklist:hover {
            background: #b91c1c;
        }

        .btn-action-unblacklist {
            background: #10b981;
            color: white;
        }

        .btn-action-unblacklist:hover {
            background: #059669;
        }

        .btn-action-view {
            background: #3b82f6;
            color: white;
        }

        .btn-action-view:hover {
            background: #2563eb;
        }

        /* 表单样式 */
        .form-container {
            background: white;
            border-radius: 15px;
            padding: 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 25px;
        }

        .form-group {
            display: flex;
            flex-direction: column;
        }

        .form-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .form-input {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .form-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-textarea {
            padding: 12px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
            resize: vertical;
            min-height: 100px;
        }

        .form-textarea:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-actions {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: #6b7280;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-secondary:hover {
            background: #4b5563;
        }

        .btn-danger {
            background: #dc2626;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-danger:hover {
            background: #b91c1c;
        }

        /* 搜索区域样式 */
        .search-container {
            background: white;
            border-radius: 15px;
            padding: 20px 30px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            margin-bottom: 30px;
        }

        .search-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            align-items: end;
        }

        .search-group {
            display: flex;
            flex-direction: column;
        }

        .search-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
        }

        .search-input {
            padding: 10px 15px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            transition: all 0.3s ease;
        }

        .search-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .search-actions {
            display: flex;
            gap: 10px;
        }

        .btn-search {
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s ease;
        }

        .btn-search-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .btn-search-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-search-secondary {
            background: #6b7280;
            color: white;
        }

        .btn-search-secondary:hover {
            background: #4b5563;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 100%;
                position: relative;
                height: auto;
            }
            
            .main-content {
                margin-left: 0;
            }
            
            .header-top {
                flex-direction: column;
                gap: 20px;
                text-align: center;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 左侧侧边栏 -->
        <nav class="sidebar">
            <div class="sidebar-header">
                <div class="sidebar-title">黑名单管理系统</div>
            </div>
            
            <ul class="nav-menu">
                <li class="nav-item">
                    <a href="#" class="nav-link active" onclick="switchFunction('blacklist')">
                        <span class="nav-icon">🚫</span>
                        <span class="nav-text">拉黑</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link" onclick="switchFunction('unblacklist')">
                        <span class="nav-icon">✅</span>
                        <span class="nav-text">解除黑名单</span>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="life-science-management.html" class="nav-link">
                        <span class="nav-icon">🏠</span>
                        <span class="nav-text">返回主页</span>
                    </a>
                </li>
            </ul>
        </nav>

        <!-- 右侧主内容区域 -->
        <main class="main-content">
            <div class="content-header">
                <div class="header-top">
                    <div class="header-left">
                        <h1>黑名单管理</h1>
                        <div class="breadcrumb">生命科学馆管理 > 黑名单管理</div>
                    </div>
                    <div class="user-info">
                        <div class="user-avatar">👤</div>
                        <div class="user-details">
                            <div class="user-name" id="current-user-name">黑名单管理员</div>
                            <div class="user-role" id="current-user-role">黑名单管理员</div>
                        </div>
                        <button class="btn-logout" onclick="logout()">退出登录</button>
                    </div>
                </div>
            </div>

            <!-- 拉黑功能 -->
            <div id="blacklist-content" class="content-section">
                <div class="function-module">
                    <div class="module-header">拉黑用户</div>
                    <div class="module-content">
                        <div class="form-container">
                            <form id="blacklist-form">
                                <div class="form-grid">
                                    <div class="form-group">
                                        <label class="form-label">姓名 *</label>
                                        <input type="text" class="form-input" name="name" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">身份证号 *</label>
                                        <input type="text" class="form-input" name="idCard" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">联系电话 *</label>
                                        <input type="tel" class="form-input" name="phone" required>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">拉黑原因 *</label>
                                        <select class="form-input" name="reason" required>
                                            <option value="">请选择拉黑原因</option>
                                            <option value="扰乱秩序">扰乱秩序</option>
                                            <option value="破坏展品">破坏展品</option>
                                            <option value="不文明行为">不文明行为</option>
                                            <option value="违规拍照">违规拍照</option>
                                            <option value="恶意投诉">恶意投诉</option>
                                            <option value="其他">其他</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">拉黑期限 *</label>
                                        <select class="form-input" name="duration" required>
                                            <option value="">请选择拉黑期限</option>
                                            <option value="7">7天</option>
                                            <option value="30">30天</option>
                                            <option value="90">90天</option>
                                            <option value="180">180天</option>
                                            <option value="365">1年</option>
                                            <option value="permanent">永久</option>
                                        </select>
                                    </div>
                                    <div class="form-group">
                                        <label class="form-label">拉黑日期 *</label>
                                        <input type="date" class="form-input" name="blacklistDate" required>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="form-label">详细说明</label>
                                    <textarea class="form-textarea" name="description" placeholder="请详细描述拉黑原因和相关情况..."></textarea>
                                </div>
                                <div class="form-actions">
                                    <button type="button" class="btn-secondary" onclick="resetBlacklistForm()">重置</button>
                                    <button type="submit" class="btn-danger">确认拉黑</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="function-module">
                    <div class="module-header">黑名单列表</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">搜索用户</label>
                                    <input type="text" class="search-input" id="search-blacklist" placeholder="输入姓名或身份证号搜索">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">拉黑原因</label>
                                    <select class="search-input" id="filter-reason">
                                        <option value="">全部原因</option>
                                        <option value="扰乱秩序">扰乱秩序</option>
                                        <option value="破坏展品">破坏展品</option>
                                        <option value="不文明行为">不文明行为</option>
                                        <option value="违规拍照">违规拍照</option>
                                        <option value="恶意投诉">恶意投诉</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchBlacklist()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearSearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <table class="data-table">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>姓名</th>
                                    <th>身份证号</th>
                                    <th>联系电话</th>
                                    <th>拉黑原因</th>
                                    <th>拉黑日期</th>
                                    <th>到期日期</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="blacklist-table-body">
                                <tr>
                                    <td>BL001</td>
                                    <td>张三</td>
                                    <td>110****1234</td>
                                    <td>138****5678</td>
                                    <td>扰乱秩序</td>
                                    <td>2024-01-15</td>
                                    <td>2024-02-15</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL001')">查看</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>BL002</td>
                                    <td>李四</td>
                                    <td>120****5678</td>
                                    <td>139****9012</td>
                                    <td>破坏展品</td>
                                    <td>2024-01-10</td>
                                    <td>2024-04-10</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL002')">查看</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>BL003</td>
                                    <td>王五</td>
                                    <td>130****9012</td>
                                    <td>137****3456</td>
                                    <td>不文明行为</td>
                                    <td>2024-01-05</td>
                                    <td>永久</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL003')">查看</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- 解除黑名单功能 -->
            <div id="unblacklist-content" class="content-section" style="display: none;">
                <div class="function-module">
                    <div class="module-header">解除黑名单</div>
                    <div class="module-content">
                        <div class="search-container">
                            <div class="search-grid">
                                <div class="search-group">
                                    <label class="search-label">搜索用户</label>
                                    <input type="text" class="search-input" id="search-unblacklist" placeholder="输入姓名或身份证号搜索">
                                </div>
                                <div class="search-group">
                                    <label class="search-label">拉黑原因</label>
                                    <select class="search-input" id="filter-unblacklist-reason">
                                        <option value="">全部原因</option>
                                        <option value="扰乱秩序">扰乱秩序</option>
                                        <option value="破坏展品">破坏展品</option>
                                        <option value="不文明行为">不文明行为</option>
                                        <option value="违规拍照">违规拍照</option>
                                        <option value="恶意投诉">恶意投诉</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                                <div class="search-group">
                                    <label class="search-label">&nbsp;</label>
                                    <div class="search-actions">
                                        <button type="button" class="btn-search btn-search-primary" onclick="searchUnblacklist()">搜索</button>
                                        <button type="button" class="btn-search btn-search-secondary" onclick="clearUnblacklistSearch()">清除</button>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <table class="data-table">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>姓名</th>
                                    <th>身份证号</th>
                                    <th>联系电话</th>
                                    <th>拉黑原因</th>
                                    <th>拉黑日期</th>
                                    <th>到期日期</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="unblacklist-table-body">
                                <tr>
                                    <td>BL001</td>
                                    <td>张三</td>
                                    <td>110****1234</td>
                                    <td>138****5678</td>
                                    <td>扰乱秩序</td>
                                    <td>2024-01-15</td>
                                    <td>2024-02-15</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-unblacklist" onclick="unblacklistUser('BL001')">解除</button>
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL001')">查看</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>BL002</td>
                                    <td>李四</td>
                                    <td>120****5678</td>
                                    <td>139****9012</td>
                                    <td>破坏展品</td>
                                    <td>2024-01-10</td>
                                    <td>2024-04-10</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-unblacklist" onclick="unblacklistUser('BL002')">解除</button>
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL002')">查看</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td>BL003</td>
                                    <td>王五</td>
                                    <td>130****9012</td>
                                    <td>137****3456</td>
                                    <td>不文明行为</td>
                                    <td>2024-01-05</td>
                                    <td>永久</td>
                                    <td><span class="status-badge status-blacklisted">黑名单中</span></td>
                                    <td class="action-buttons">
                                        <button class="btn-action btn-action-unblacklist" onclick="unblacklistUser('BL003')">解除</button>
                                        <button class="btn-action btn-action-view" onclick="viewBlacklistInfo('BL003')">查看</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </main>
    </div>

    <script>
        // 页面加载时设置用户信息
        document.addEventListener('DOMContentLoaded', function() {
            const currentUser = localStorage.getItem('blacklistCurrentUser');
            if (currentUser) {
                const user = JSON.parse(currentUser);
                document.getElementById('current-user-name').textContent = user.name || '黑名单管理员';
                document.getElementById('current-user-role').textContent = user.role || '黑名单管理员';
            }
        });

        // 功能切换
        function switchFunction(functionName) {
            // 移除所有活动状态
            document.querySelectorAll('.nav-link').forEach(link => {
                link.classList.remove('active');
            });
            
            // 添加活动状态到当前点击的链接
            event.target.closest('.nav-link').classList.add('active');
            
            // 隐藏所有内容
            const allContent = document.querySelectorAll('.content-section');
            allContent.forEach(content => {
                content.style.display = 'none';
            });

            // 显示对应内容
            const targetContent = document.getElementById(functionName + '-content');
            if (targetContent) {
                targetContent.style.display = 'block';
            }
        }

        // 拉黑表单提交
        document.getElementById('blacklist-form').addEventListener('submit', function(e) {
            e.preventDefault();
            const formData = new FormData(this);
            
            // 获取表单数据
            const blacklistData = {
                id: 'BL' + Date.now(),
                name: formData.get('name'),
                idCard: formData.get('idCard'),
                phone: formData.get('phone'),
                reason: formData.get('reason'),
                duration: formData.get('duration'),
                blacklistDate: formData.get('blacklistDate'),
                description: formData.get('description')
            };

            // 这里可以添加数据验证和提交逻辑
            console.log('拉黑用户数据:', blacklistData);
            alert('用户已成功拉黑！');
            
            // 重置表单
            this.reset();
        });

        // 重置拉黑表单
        function resetBlacklistForm() {
            document.getElementById('blacklist-form').reset();
        }

        // 搜索黑名单
        function searchBlacklist() {
            const searchTerm = document.getElementById('search-blacklist').value;
            const filterReason = document.getElementById('filter-reason').value;
            alert(`搜索黑名单: ${searchTerm}, 原因: ${filterReason}`);
        }

        // 搜索解除黑名单
        function searchUnblacklist() {
            const searchTerm = document.getElementById('search-unblacklist').value;
            const filterReason = document.getElementById('filter-unblacklist-reason').value;
            alert(`搜索解除黑名单: ${searchTerm}, 原因: ${filterReason}`);
        }

        // 清除搜索
        function clearSearch() {
            document.getElementById('search-blacklist').value = '';
            document.getElementById('filter-reason').value = '';
        }

        // 清除解除黑名单搜索
        function clearUnblacklistSearch() {
            document.getElementById('search-unblacklist').value = '';
            document.getElementById('filter-unblacklist-reason').value = '';
        }

        // 查看黑名单信息
        function viewBlacklistInfo(id) {
            alert(`查看黑名单信息 ID: ${id}`);
        }

        // 解除黑名单
        function unblacklistUser(id) {
            if (confirm('确定要解除这个用户的黑名单吗？')) {
                alert(`解除黑名单 ID: ${id}`);
            }
        }

        // 退出登录
        function logout() {
            localStorage.removeItem('blacklistIsLoggedIn');
            localStorage.removeItem('blacklistCurrentUser');
            window.location.href = 'life-science-management.html';
        }
    </script>
</body>
</html>
